package com.sx.zongzhi.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.sx.zongzhi.R;
import com.sx.zongzhi.bean.PopulationMoveDetailBean;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * Created by XZY on 2017/11/28.
 * 流入信息
 */
public class MoveInforFragment extends Fragment {

    @BindView(R.id.tv_PlaceType)
    TextView tv_PlaceType;
    @BindView(R.id.tv_InReason)
    TextView tv_InReason;
    @BindView(R.id.tv_CredType)
    TextView tv_CredType;
    @BindView(R.id.tv_CredNum)
    TextView tv_CredNum;
    @BindView(R.id.tv_RegData)
    TextView tv_RegData;
    @BindView(R.id.tv_EndData)
    TextView tv_EndData;
    @BindView(R.id.tv_KeyPerson)
    TextView tv_KeyPerson;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_move_infor,container,false);
        ButterKnife.bind(this,view);
        PopulationMoveDetailBean detailBean = (PopulationMoveDetailBean)
                getArguments().getSerializable("PopulationMoveDetailBean");
        initView(detailBean);
        return view;
    }



    private void initView(PopulationMoveDetailBean detailBean) {
        if (detailBean!=null){
            try {
                tv_PlaceType.setText(detailBean.getStayLocationType()!=null?
                        detailBean.getStayLocationType().getDisplayName():"未知");
                tv_InReason.setText(detailBean.getInflowingReason()!=null?
                        detailBean.getInflowingReason().getDisplayName():"未知");
                tv_CredType.setText(detailBean.getRegistrationType()!=null?
                        detailBean.getRegistrationType().getDisplayName():"未知");
                tv_CredNum.setText(detailBean.getCertificateNumber());
                tv_RegData.setText(detailBean.getRegisterDate());
                tv_EndData.setText(detailBean.getExpectedDatedue());
                tv_CredNum.setText(detailBean.getCertificateNumber());
                if (detailBean.getIsEmphasis()==1){
                    tv_KeyPerson.setText("是");
                }else {
                    tv_KeyPerson.setText("否");
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }

}
